﻿/**
 * Reboulder - Partial Boulder Dash clone
 * Jesús Sagra, 2014
 * 
 * Player class: sprite used by real players
 * 
 * Version    Date     Changes
 * -----------------------------------------------------
 *  0.01   06-mar-2015  Constructor, movement.
 *  0.02   06-mar-2015  Player death, lives-- , restart position.
 */

class Player : Sprite
{
    public byte Lives { get; set; }
    public int StartX { get; set; }
    public int StartY { get; set; }
    public int ScreenX { get; set; }
    public int ScreenY { get; set; }

    public Player(int x, int y) : base(x,y)
    {
        Lives = 3;
        StartX = ScreenX = x;
        StartY = ScreenY = y;
        Speed = 32;
        SpriteImage = new Image("data/player.png");
    }


    //Payer death: restart position, lose a life
    public void Die()
    {
        Lives--;
        X = StartX;
        Y = StartY;
    }


    public override void MoveRight()
    {
        base.MoveRight();
        ScreenX += Speed;
    }

    
    public override void MoveLeft()
    {
        base.MoveLeft();
        ScreenX -= Speed;
    }

    
    public override void MoveDown()
    {
        base.MoveDown();
        ScreenY += Speed;
    }


    public override void MoveUp()
    {
        base.MoveUp();
        ScreenY -= Speed;
    }
}